/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.dao.hibernate;

import com.click.app.dao.CutProcessDao;
import com.click.app.model.CutProcess;
import com.click.app.model.Employee;
import java.util.List;

/**
 *
 * @author ariel
 */
public class CutProcessDaoHibernate extends GenericDaoHibernate<CutProcess, Long> implements CutProcessDao{

    public CutProcessDaoHibernate() {
        super(CutProcess.class);
    }
    public CutProcess getById(Long id){
        CutProcess cp = null;
        cp = (CutProcess)getHibernateTemplate().get( CutProcess.class , id);
        return cp;
    }

    public List<CutProcess> findByEmployeePay(Employee employee) {
        return getHibernateTemplate().find("from CutProcess where employee=? AND totalCurrentAmount>0 order by endDate", employee);
    }
    public List<CutProcess> getCutProcesses(){
        return getHibernateTemplate().find("from CutProcess cp order by cp.initDate desc ");
    }
}
